package com.hyz.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hyz.pojo.assetLog.AssetLog;
import com.hyz.service.AssetLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/4 19:06
 */
@RestController
@RequestMapping("/assetLog")
public class AssetLogController {
    @Autowired
    private AssetLogService service;

    @PostMapping("/getAssetLogsByAssetId")
    public List<AssetLog> getAssetLogsByAssetId(@RequestBody Long assetId) {
        LambdaQueryWrapper<AssetLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(AssetLog::getAssetId, assetId);
        return service.list(wrapper);
    }
}
